package com.mall.cart.controller;

import com.mall.cart.service.CartService;
import com.mall.cart.vo.CartItemVo;
import com.mall.cart.vo.CartVo;
import com.mall.common.utils.Result;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author: 谢君臣
 * @Date: 2022/8/8-14:11
 * @version: 1.0
 * @function:
 */
@RestController
@RequestMapping("/cart")
public class CartController {

    @Resource
    private CartService cartService;

    @GetMapping("/items")
    public Result<List<CartItemVo>> getCurrentCartItems(){
        List<CartItemVo> cartItems = cartService.getCurrentCartItems();
        return new Result<List<CartItemVo>>().ok(cartItems);
    }


}
